<template>
  <div>
    <el-collapse-transition>
      <div
        id="FlowEditor-AttributesPanel"
        :class="{
          'FlowEditor-AttributesPanel--withSelections': panelBool,
          'transition-box': true,
        }"
      >
        <div class="editor-right-panel">
          <div
            :class="[panelBool ? 'right-panel-arrow' : 'right-panel-arrowa']"
            @click="switchPanel"
          >
            <i
              :class="[
                panelBool ? 'el-icon-caret-right' : 'el-icon-caret-left',
              ]"
            ></i>
          </div>
        </div>
        <div class="panel" v-show="panelBool">
          <AmisRender :schema="schema" :data="data" />
        </div>
      </div>
    </el-collapse-transition>
  </div>
</template>
<script>
import AmisRender from "../Amis/AmisRender.vue";
import { mapMutations } from "vuex";
export default {
  name: "RightPanel",
  components: {
    AmisRender,
  },
  props: {
    schema: {
      type: Object,
      default() {
        return {};
      },
    },
    data: {
      type: Object,
      default() {
        return {};
      },
    },
    dialogVisible: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      currentPanelBool: true,
    };
  },
  methods: {
    ...mapMutations(["setRightPanelBool"]),
    test() {
      console.log("test");
    },
    switchPanel() {
      // console.log(this, "this");
      // console.log(this.setRightPanelBool, "this.test");
      this.setRightPanelBool(!this.panelBool);
    },
  },
  computed: {
    panelBool() {
      return this.$store.state.panel.rightPanelBool;
    },
  },
  watch: {},
  mounted() {},
};
</script>
<style  >
#FlowEditor-AttributesPanel {
  height: 100%;
  position: relative;
}
.FlowEditor-AttributesPanel--withSelections {
  width: 100%;
  /* width: calc(100% + 100px); */
}
#FlowEditor-AttributesPanel .panel {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.editor-right-panel .right-panel-arrow {
  position: absolute;
  width: 16px;
  height: 50px;
  top: 50%;
  left: -15px;
  transform: translateY(740%);
  background-color: transparent;
  box-sizing: border-box;
  z-index: 10;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.editor-right-panel .right-panel-arrowa {
  position: absolute;
  width: 16px;
  height: 50px;
  top: 50%;
  left: -15px;
  transform: translateY(930%);
  background-color: transparent;
  box-sizing: border-box;
  z-index: 10;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.editor-right-panel .right-panel-arrowa::before {
  content: "";
  position: absolute;
  border-radius: 10px 0 0 10px;
  box-sizing: border-box;
  border-right: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #ddd;
  z-index: -1;
  transform: perspective(50px) rotateY(-30deg);
  transition: all 0.15s;
}
.editor-right-panel .right-panel-arrow::before {
  content: "";
  position: absolute;
  border-radius: 10px 0 0 10px;
  box-sizing: border-box;
  border-right: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #ddd;
  z-index: -1;
  transform: perspective(50px) rotateY(-30deg);
  transition: all 0.15s;
}
</style>